Skip to content

CODEGEN-334 - Fix ignoreNoDocuments swallowing all errors, not just no document errors#10338

Merged
eddeee888 merged 10 commits intomasterfrom
fix-ignore-no-doc-issue
May 4, 2025
Merged

CODEGEN-334 - Fix ignoreNoDocuments swallowing all errors, not just no document errors#10338
eddeee888 merged 10 commits intomasterfrom
fix-ignore-no-doc-issue

Conversation

@eddeee888
Copy link
Copy Markdown
Collaborator

Description

Related #9172

This PR fixes the issue where ignoreNoDocuments flag catches and swallows all errors such as syntax errors, and not just when no documents can be found. This uses feature implemented in ardatan/graphql-tools#7093

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit test

Comment thread packages/graphql-codegen-cli/tests/generate-and-save.spec.ts
Comment thread packages/graphql-codegen-cli/tests/generate-and-save.spec.ts
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2025

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/cli 5.0.6-alpha-20250503091728-60da34d73a34e0e564025094b103c5449f87e0bb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-operations 4.6.1-alpha-20250503091728-60da34d73a34e0e564025094b103c5449f87e0bb npm ↗︎ unpkg ↗︎
@graphql-codegen/typescript-resolvers 4.5.1-alpha-20250503091728-60da34d73a34e0e564025094b103c5449f87e0bb npm ↗︎ unpkg ↗︎
@graphql-codegen/client-preset 4.8.1-alpha-20250503091728-60da34d73a34e0e564025094b103c5449f87e0bb npm ↗︎ unpkg ↗︎
@graphql-codegen/graphql-modules-preset 4.0.17-alpha-20250503091728-60da34d73a34e0e564025094b103c5449f87e0bb npm ↗︎ unpkg ↗︎

Comment thread packages/graphql-codegen-cli/tests/generate-and-save.spec.ts
Comment thread packages/graphql-codegen-cli/tests/test-files/graphql.config.json
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2025

💻 Website Preview

The latest changes are available as preview in: https://pr-10338.graphql-code-generator.pages.dev

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 14, 2025

🦋 Changeset detected

Latest commit: 60da34d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@eddeee888
Copy link
Copy Markdown
Collaborator Author

In the end, I couldn't pin graphql-config to later version (>5.1.4) to work for this PR because of the current Node 16 requirement/test. 😢
These later versions have the same @graphql-tools/load version ^8.1.0, which helps making lock files cleaner. However, the graphql-config version doesn't support Node 16, which Codegen is still supporting.
This is a nice-to-have though. So, we can just merge this PR as-is.

Note:

  • We will soon release a breaking change to drop Node 16 and 18 support (Both EOL by the time this PR is merged)
  • Consumers that are on Node 16 (EOL in 11 Sep 2023) and installs the latest graphql-config may experience runtime errors. But in my testing, I can't install latest Codegen with Node 16 because of a dep requirement, so I feel this is a very rare scenario, and we can suggest consumers to update to at least Node 18.

@eddeee888 eddeee888 merged commit 5d1c4e1 into master May 4, 2025
18 checks passed
@eddeee888 eddeee888 deleted the fix-ignore-no-doc-issue branch May 4, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants